package com.gtn.exam.title.bd.service.impl;

import org.apache.log4j.Logger;

import com.gtn.exam.title.bd.service.BusinessService;
import com.gtn.exam.title.persistence.dao.PersistanceDAO;
import com.gtn.exam.title.persistence.domain.TempTable;

/**
 * The Business Service class which implements {@link BusinessService}
 * 
 * @author Rukshan Silva | 13th August 2014
 * @version 1.0.0
 */
public class BusinessServiceImpl implements BusinessService {

	private static Logger log = Logger.getLogger(BusinessServiceImpl.class);

	private PersistanceDAO persistanceDAO;

	/**
	 * @param persistanceDAO
	 *            the persistanceDAO to set
	 */
	public void setPersistanceDAO(PersistanceDAO persistanceDAO) {
		this.persistanceDAO = persistanceDAO;
	}

	/**
	 * {@inheritDoc}
	 */
	public String doProcessing1() {

		TempTable tempTable = new TempTable();
		tempTable.setUserName("TEMP 2");
		persistanceDAO.save(tempTable);

		log.info("[SUCCESS] Perfomed the Main Business Logic 1");

		return "success";
	}

	/**
	 * {@inheritDoc}
	 */
	public String doProcessing2(String name) {

		persistanceDAO.updateLoggedInClient("cmZQdVH4cy0htVV");

		log.info("[SUCCESS] Perfomed the Main Business Logic 2 - " + name);
		return name;
	}
}
